class Solution:
    def getSmallestString(self, n: int, k: int) -> str:
        res = ""
        for i in range(n, 0, -1):
            surplus = k - i + 1
            choose = 26 if surplus >= 26 else surplus
            res = chr(choose + ord('a') - 1) + res
            k -= choose

        return res
